-- BonusItemDescM
-- Create by chendh
-- 物品随机奖励描述

module("BonusItemDescM", package.seeall);

-- 配置信息
local bonusItemTable = {};

-- 载入配置表
local _init = false;
local loadCsv = function()
    if _init then return end
    _init = true;

    -- 转换下表
    local desc_CSV = get_bonus_item_desc_CSV();
    for i = 1, #desc_CSV do
        bonusItemTable[desc_CSV[i].id] = desc_CSV[i];
    end

    desc_CSV = {};
end

-- 模块初始化
function init()
    loadCsv();
end

-- 检索信息
function query(id, path)
    local m = bonusItemTable[id]

    if not m or path == "" or not path then
        return m
    end

    return m[path]
end
